|
This page last changed on Nov 29, 2005 by vidya.
You need to edit in 'Wiki Markup' mode to include macros in your page.
The Code Block Macro allows you to display source code in your document with the appropriate syntax highlighting.
You can specify the programming language. Confluence currently supports Java, XML and SQL with Java being the default language for this macro.
Code Block Macro
{code:language} ... code ... {code}
OR
{code} ... java code ... {code}
Example 1: Java
| What you need to type |
What you will get |
{code}
public String getFoo()
{
return foo;
}
{code} |
|
Example 2: XML
| What you need to type |
What you will get |
{code:XML}
<test>
<another tag="attribute"/>
</test>
{code} |
|
RELATED TOPICS
Working with Macros
Take me back to Confluence 2.0 Home
|
How about a feature to have line numbers in the code block that you can toggle on and off?
For example: http://wiki.apache.org/geronimo/CodingStandards#

Posted by ed@edhorne.com at Jan 18, 2006 13:17
|
|
This page would do well to declare a list of supported languages.

Posted by tezza at May 08, 2006 20:45
|
|
Here's more detailed documentation: http://www.adaptavist.com/display/USERGUIDE/code+macro
Note that in Confluence 2.2, there is a new Code Formatter plugin so it's possible that there may be other languages supported at a later date.

Posted by gfraser at May 08, 2006 20:50
|
|